import time

from selenium import webdriver
from selenium.webdriver.common.by import By
#打开浏览器
driver = webdriver.Chrome()
#进入ecshopPC演示站
driver.get('https://ecshop.test2.shopex123.com/')
#定位免费注册按钮
driver.find_element(By.XPATH,'//*[@id="ECS_MEMBERZONE"]/a[2]').click()
#定位所有注册输入框输入内容
time.sleep(2)
username = driver.find_element(By.ID,'username')
username.send_keys('a525855722')
time.sleep(2)
email = driver.find_element(By.ID,'email')
email.send_keys('525855722@qq.com')
time.sleep(2)
password = driver.find_element(By.ID,'password1')
password.send_keys('JH13277968935')
time.sleep(2)
confirm_password = driver.find_element(By.ID,'confirm_password')
confirm_password.send_keys('JH13277968935')
#定位同意协议并注册按钮并点击
time.sleep(2)
agree_to_register = driver.find_element(By.XPATH,'//*[@id="main"]/div[2]/form/div[9]/input[3]')
agree_to_register.click()
#关闭浏览器
time.sleep(10)
driver.quit()